<?php
class TeacherAction extends AppAction {
	private $lib;
	function __construct() {
		parent::__construct ();
		require_once APP_LIB_PATH . 'teacherLib.php';
		$this->lib = new TeacherLib ();
	}
	
	private function testInfo() {
		ViewData::$form_data->TeacherName = '我是老师';
		ViewData::$form_data->Sex = '1';
		ViewData::$form_data->Nation = '汉'; //民族
		ViewData::$form_data->Photo = '';
		ViewData::$form_data->Height = '154';
		ViewData::$form_data->Weight = '56';
		ViewData::$form_data->Political = '清白'; //政治面貌 
		ViewData::$form_data->BirthdayYear = '1987';
		ViewData::$form_data->BirthdayMonth = '12';
		ViewData::$form_data->Origin = '福建'; //籍贯
		ViewData::$form_data->Graduation = '2009年7月'; //毕业时间
		ViewData::$form_data->Education = '本科'; //学历
		ViewData::$form_data->EducationalSystem = '4年'; //学制
		ViewData::$form_data->Professional = '计算机科学与技术'; //专业
		ViewData::$form_data->GraduateSchool = '福州大学'; //毕业学校
		ViewData::$form_data->Address = '厦门市思明区';
		ViewData::$form_data->EnglishLevel = '4级';
		ViewData::$form_data->ComputerLevel = '4级';
		ViewData::$form_data->GoodAt = '英语';
		ViewData::$form_data->Phone = '0592-5784549';
		ViewData::$form_data->Mobile = '15259267958';
		ViewData::$form_data->QQ = '963941224';
		ViewData::$form_data->Soft = '无';
		ViewData::$form_data->WorkTime = '2009';
		ViewData::$form_data->WorkSchool = '莲花中学';
		ViewData::$form_data->WorkProfessional = '幼教';
		ViewData::$form_data->Introduction = '自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍绍自我介绍'; //自我介绍
		ViewData::$form_data->Assessment = '自我评定自我评定自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍自我自我介绍自我介绍自我介绍自我介绍自我介绍自我介绍介绍自我介绍'; //自我评定
	}
	
	public function index() {
		ViewData::$title = "教师报名";
		ViewData::$form_data = new RegisteTeacherClass ();
		ViewData::$form_hint = new RegisteTeacherClass ();
		$this->testInfo ();
		if ($_POST) {
			$this->lib->checkForm ();
			if (! BaseAction::isObjectEmpty ( ViewData::$form_hint )) {
				BaseAction::loadView ( "registeTeacher" );
			}
			try {
				$studentId = $this->lib->registeLogic ();
				BaseAction::loadView ( "registeTeacherSuccess" );
			
			} catch ( Exception $e ) {
				ViewData::$form_hint->Message = $e->getMessage ();
			}
		}
		BaseAction::loadView ( "registeTeacher" );
	}
}